<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="bit.util.ConnectionContext"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
String sql = "SELECT * FROM champ " +
			"ORDER BY no DESC";

Connection conn = ConnectionContext.getConnection();
PreparedStatement pstmt = conn.prepareStatement(sql);

ResultSet rs = pstmt.executeQuery();

%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LOL 챔피언 정보</title>
<script type="text/javascript" src="lolChamp.js"></script>
<style type="text/css">
	
	#addFormDiv {
		background-color: #ffffff;
		position: absolute;
		left: 150px;
		top: 50px;
		z-index: 10;
		visibility: hidden;
	}
	
	#shadowLayer {
		position: absolute;
		left: 0px;
		top: 0px;
		z-index: 5;
		width: 100%;
		height: 100%;
		background-color: #000000;
		opacity: 0.5;
		visibility: hidden;
	}
	
</style>
</head>
<body>

<table border="1">
	<tr>
		<th>No</th>
		<th>이름</th><!-- <td align="center"><b></b></td> -->
		<th>타입</th>
		<th>체력</th>
		<th>공격력</th>
		<th>등록일</th>
		<th>관리</th>
	</tr>
<%
while (rs.next()) {
	int no = rs.getInt("no");
	String name = rs.getString("name");
	String type = rs.getString("type");
	int health = rs.getInt("health");
	int damage = rs.getInt("damage");
%>
<form id="modifyForm<%= no %>" action="#" onsubmit="return false;">
	<input type="hidden" name="no" value="<%= no %>" />
	<tr>
		<td><%= no %></td>
		<td><input type="text" name="name" value="<%= name %>" size="10" readonly="readonly" style="border-width: 0px;" /></td>
		<td><input type="text" name="type" value="<%= type %>" size="10" readonly="readonly" style="border-width: 0px;" /></td>
		<td><input type="text" name="health" value="<%= health %>" size="5" readonly="readonly" style="border-width: 0px;" /></td>
		<td><input type="text" name="damage" value="<%= damage %>" size="5" readonly="readonly" style="border-width: 0px;" /></td>
		<td><%= rs.getDate("regdate") %></td>
		<td>
			<input name="modifyBtn" type="button" value="수정" onclick="enableModify('modifyForm<%= no %>');" />
			<input name="saveBtn" type="button" value="저장" onclick="saveModify('modifyForm<%= no %>');" style="display: none;" />
			/
			<input name="cancelBtn" type="button" value="취소" style="display: none;" onclick="cancelModify('modifyForm<%= no %>');" />
			<input name="deleteBtn" type="button" value="삭제" onclick="deleteChamp('modifyForm<%= no %>');" />
		</td>
	</tr>
</form>
<%
}

rs.close();
pstmt.close();
%>
</table>

<input type="button" value="챔피언 등록" onclick="showAddForm();" />

<div id="shadowLayer"></div>

<div id="addFormDiv">
	<form id="addForm" action="#" method="post" onsubmit="return false;">
		<table>
			<tr>
				<td>챔피언 이름</td>
				<td><input type="text" name="champName" /></td>
			</tr>
			<tr>
				<td>타입</td>
				<td><input type="text" name="champType" /></td>
			</tr>
			<tr>
				<td>체력</td>
				<td><input type="text" name="champHealth" /></td>
			</tr>
			<tr>
				<td>공격력</td>
				<td><input type="text" name="champAttack" /></td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<input type="button" value="등록" onclick="submitAddForm();" />
					<input type="button" value="취소" onclick="hideAddForm();" />
				</td>
			</tr>
		</table>
	</form>
</div>

</body>
</html>






